<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>13-引用animate</title>

</head>
<body>
     <style>
        .sliderbar {
            position: fixed;
            right: 0;
            bottom: 200px;
            width: 40px;
            height: 40px;
            text-align: center;
            line-height: 40px;
            cursor: pointer;
            color: #fff;
        }

        .con {
            position: absolute;
            left: 0;
            top: 0;
            width: 200px;
            height: 40px;
            background-color: purple;
            z-index: -1;
        }
    </style>
    <!-- 引入动画 -->
    <script src="./animate.js"></script>
</body>
<div class="sliderbar">
    <span>←</span>
    <div class="con">问题反馈</div>
</div>

<script>
    /* 
        需求：
            1. 鼠标接触侧边栏，div 动画，span内容变化
            2. 鼠标离开侧边栏，div 再次动画，span内容变化
    */
   let sliderbar = document.querySelector('.sliderbar');
   let span = document.querySelector('span');
   let con = document.querySelector('.con');

   sliderbar.addEventListener('mouseenter',function(){
       span.innerHTML = "->";
       animate(con,-160);
   });
   sliderbar.addEventListener('mouseleave',function(){
       span.innerHTML = "<-";
       animate(con,0);
   });
</script>
</html>